<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24"> </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->

    <!-- table区域-begin -->
    <div>
      <a-table
        ref="table"
        size="small"
        :scroll="{ x: true }"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
        class="j-table-force-nowrap"
      >
      </a-table>
    </div>
  </a-card>
</template>

<script>
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { filterMultiDictText } from '@/components/dict/JDictSelectUtil'
import { queryhistorylist } from '@/api/api'
import { getAction } from '@api/manage'
export default {
  name: 'HfSalepriceHistoryList',
  mixins: [JeecgListMixin, mixinDevice],

  data() {
    return {
      description: '销售价格方案历史查询页面',
      disableMixinCreated: true,
      // 表头
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: 'center',
          customRender: function(t, r, index) {
            return parseInt(index) + 1
          }
        },
        {
          title: '价格编号',
          align: 'center',
          dataIndex: 'serialNumber'
        },
        {
          title: '客户名称',
          align: 'center',
          dataIndex: 'customName_dictText'
        },
        {
          title: '产品代码',
          align: 'center',
          dataIndex: 'productCode'
        },
        {
          title: '产品名称',
          align: 'center',
          dataIndex: 'productName'
        },
        {
          title: '单价',
          align: 'center',
          dataIndex: 'price'
        },
        {
          title: '含税单价',
          align: 'center',
          dataIndex: 'taxPrice'
        },
        {
          title: '执行时间',
          align: 'center',
          dataIndex: 'useTime'
        },
        {
          title: '规格型号',
          align: 'center',
          dataIndex: 'sap'
        },
        {
          title: '单位',
          align: 'center',
          dataIndex: 'unit_dictText'
        },

        {
          title: '税率',
          align: 'center',
          dataIndex: 'tax',
          customRender: r => {
            return r + '%'
          }
        }
      ],
      url: {
        list: '/sale/hfSalePrice/list',
        deleteBatch: '/sale/hfSalePrice/deleteBatch'
      },
      dictOptions: {}
    }
  },
  created() {},
  computed: {
    importExcelUrl: function() {
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
    }
  },
  methods: {
    openlist(record) {
      this.$nextTick(() => {
        this.queryParam.customName = record.customName
        this.queryParam.productId = record.productId
        this.loadData()
      })
    },
    loadData() {
      this.ipagination.current = 1
      this.dataSource = []
      var params = this.getQueryParams() //查询条件
      params['isDelete'] = 1
      this.loading = true
      getAction(this.url.list, params)
        .then(res => {
          if (res.success) {
            this.dataSource = res.result.records || res.result
            if (res.result.total) {
              this.ipagination.total = res.result.total
            } else {
              this.ipagination.total = 0
            }
          } else {
            this.$message.warning(res.message)
          }
        })
        .finally(() => {
          this.loading = false
        })
    }
  }
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>
